﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace STT.Home
{
    public partial class GoogleMapForASPNet : System.Web.UI.UserControl
    {
        public delegate void PushpinMovedHandler(string pID);
        public event PushpinMovedHandler PushpinMoved;
       

        public void OnPushpinMoved(string pID)
        {
           
            if (PushpinMoved != null)
            {
              
                GoogleMapObject = (GoogleObject)System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT"];
                PushpinMoved(pID);
            }
        }


        #region Properties

        GoogleObject _googlemapobject = new GoogleObject();
        public GoogleObject GoogleMapObject
        {
            get { return _googlemapobject; }
            set { _googlemapobject = value; }
        }

        #endregion


        protected void Page_Load(object sender, EventArgs e)
        {
           
            if (hidEventName.Value == "PushpinMoved")
            {
              
                hidEventName.Value = "";
                OnPushpinMoved(hidEventValue.Value);
            }
            if (!IsPostBack)
            {
                Session["GOOGLE_MAP_OBJECT"] = GoogleMapObject;
            }
            else
            {
                GoogleMapObject = (GoogleObject)Session["GOOGLE_MAP_OBJECT"];
            }
        }
    }
}